<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
  <head>
    <title></title>
    <link rel="stylesheet" type="text/css" href="${path}/css/editTable.css">
    
    <script type="text/javascript">
    	function check(){
    		var sp_code_id = document.getElementById("sp_code_id").value;
    		if("" == sp_code_id || "0" == sp_code_id){
     			alert("请选择业务短号码");
     			return false;
     		}
    		
    		var sp_number = document.getElementById("sp_number").value;
     		if("" == sp_number){
     			alert("请输入业务长号码");
     			return false;
     		}
     		
     		var sync_url = document.getElementById("sync_url").value;
     		if("" == sync_url){
     			alert("请输入路由地址");
     			return false;
     		}
     		
     		var lower_id = document.getElementById("lower_id").value;
     		if("" == lower_id || "0" == lower_id){
     			alert("请选择渠道名称");
     			return false;
     		}
    		
    		var name = document.getElementById("name").value;
     		if("" == name){
     			alert("请输入路由名称");
     			return false;
     		}
     		var start_second = document.getElementById("start_second").value;
     		if("" == start_second){
     			alert("请输入开始秒数");
     			return false;
     		}
     		var end_second = document.getElementById("end_second").value;
     		if("" == end_second){
     			alert("请输入结束秒数");
     			return false;
     		}
    	}
    </script>
  </head>
  <body>
    <div>
    	<form id="editConfigRouterForm" name="editConfigRouterForm" method="post" action="${path }/configRouter/updateConfigRouter.action" onsubmit="return check();">
    		<p>填写路由信息</p>
    		<c:choose>
    			<c:when test="${configRouterVo.id == null}">
    				<input type="hidden" name="configRouterVo.id" value="0" />
    			</c:when>
    			<c:otherwise>
    				<input type="hidden" name="configRouterVo.id" value="${configRouterVo.id }" />
    			</c:otherwise>
    		</c:choose>
    		<table>
    			<tr>
    				<td>业务短号码</td>
    				<td>
    					<select id="sp_code_id" name="configRouterVo.sp_code_id">
    						<option value="0">--请选择--</option>
    						<c:if test="${configBusinessVoList != null && fn:length(configBusinessVoList) > 0 }">
    							<c:forEach items="${configBusinessVoList }" var="configBusinessVo" varStatus="i">
    								<option value="${configBusinessVo.id }" <c:if test="${configBusinessVo.id == configRouterVo.sp_code_id }">selected="selected"</c:if>>${configBusinessVo.sp_code }</option>
    							</c:forEach>
    						</c:if>
    					</select>
    					<span style="color: red;size: 2px;">&nbsp;*必选项</span>
    				</td>
    			</tr>
    			<tr>
    				<td>业务长号码</td>
    				<td>
    					<input type="text" id="sp_number" name="configRouterVo.sp_number" value="${configRouterVo.sp_number }" size="10" maxlength="10" />
    					<span style="color: red;size: 2px;">&nbsp;*必填项&nbsp;&nbsp;请输入长号码并且是业务短号码的子号码</span>
    				</td>
    			</tr>
    			<tr>
    				<td>是否自消费</td>
    				<td>
    					<select id="is_self_consum" name="configRouterVo.is_self_consum">
    						<option value="0" <c:if test="${configRouterVo.is_self_consum == 0 }">selected="selected"</c:if>>否</option>
    						<option value="1" <c:if test="${configRouterVo.is_self_consum == 1 }">selected="selected"</c:if>>是</option>
    					</select>
    				</td>
    			</tr>
    			<tr>
    				<td>路由地址</td>
    				<td>
    					<input type="text" id="sync_url" name="configRouterVo.sync_url" value="${configRouterVo.sync_url }" />
    					<span style="color: red;size: 2px;">&nbsp;*必填项(从渠道处获得)&nbsp;&nbsp;格式:http://127.0.0.1:8080/test/test.html</span>
    				</td>
    			</tr>
    			<tr>
    				<td>渠道名称</td>
    				<td>
    					<select id="lower_id" name="configRouterVo.lower_id">
    						<option value="0">--请选择--</option>
    						<c:if test="${configLowerPartnerVoList != null && fn:length(configLowerPartnerVoList) > 0 }">
    							<c:forEach items="${configLowerPartnerVoList }" var="configLowerPartnerVo" varStatus="i">
    								<option value="${configLowerPartnerVo.id }" <c:if test="${configLowerPartnerVo.id == configRouterVo.lower_id }">selected="selected"</c:if>>${configLowerPartnerVo.name }</option>
    							</c:forEach>
    						</c:if>
    					</select>
    					<span style="color: red;size: 2px;">&nbsp;*必选项</span>
    				</td>
    			</tr>
    			<tr>
    				<td>路由名称</td>
    				<td>
    					<input type="text" id="name" name="configRouterVo.name" value="${configRouterVo.name }" />
    					<span style="color: red;size: 2px;">&nbsp;*必填项</span>
    				</td>
    			</tr>
    			<tr>
    				<td>路由详情</td>
    				<td>
    					<input type="text" id="detail" name="configRouterVo.detail" value="${configRouterVo.detail }" />
    				</td>
    			</tr>
    			<tr>
    				<td>开始秒数</td>
    				<td>
    					<input type="text" id="start_second" name="configRouterVo.start_second" value="${configRouterVo.start_second }" />
    				</td>
    			</tr>
    			<tr>
    				<td>结束秒数</td>
    				<td>
    					<input type="text" id="end_second" name="configRouterVo.end_second" value="${configRouterVo.end_second }" />
    				</td>
    			</tr>
    			<tr>
    				<td colspan="2">
    					<input type="submit" name="submit" value="确认" />
    				</td>
    			</tr>
    		</table>
    	</form>
    </div>
  </body>
</html>